Spring 5 Recipes by Marten Deinum Daniel Rubio & Josh Long

Spring 5 Recipes by Marten Deinum Daniel Rubio & Josh Long

Author:Marten Deinum, Daniel Rubio & Josh Long
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Properties properties = new Properties();

properties.setProperty(AvailableSettings.DIALECT, PostgreSQL95Dialect.class.getName());

properties.setProperty(AvailableSettings.SHOW_SQL, String.valueOf(true));

properties.setProperty(AvailableSettings.HBM2DDL_AUTO, "update");

return properties;

}}

Or you can even ignore the Hibernate configuration file by merging all the configurations into LocalSessionFactoryBean. For example, you can specify the packages containing the JPA annotated classes in the packagesToScan property and other Hibernate properties such as the database dialect in the hibernateProperties property.

@Configuration

public class CourseConfiguration {

...

@Bean

public LocalSessionFactoryBean sessionfactory() {

LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();

sessionFactoryBean.setDataSource(dataSource());

sessionFactoryBean.setPackagesToScan("com.apress.springrecipes.course");

sessionFactoryBean.setHibernateProperties(hibernateProperties());

return sessionFactoryBean;

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.